package com.weiiew.common.entity.qo;

import lombok.Data;
import org.apache.logging.log4j.util.Strings;

import java.util.List;

/**
 * @Description
 * @Author 魏锴
 * @Date 2024/7/31
 */
@Data
public class RecipeQo implements QoInter{
    private String name;
    private Long ingredient;
    private Long product;
    private List<Long> building;
    private Integer version;
    private Integer limit;
    private Integer offset;

    @Override
    public boolean check() {
        return limit > 0 && offset >= 0 && version != null;
    }

    @Override
    public void format() {
        if (name == null || name.equals("")) name = null;
    }
    public String getHasPageKey() {
        return version + "&" + name + "&" + ingredient + "&" + product + "&" + limit + "&" +
                offset + "&[" + Strings.join(building, '&') + "]";
    }
    public String getNoPageKey(){
        return version + "&" + name + "&" + ingredient + "&" + product +
                "&[" + Strings.join(building, '&') + "]";
    }
}
